(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";

loader.define(function (requires, exports, module, global) {
  var pageview = {};

  pageview.init = function () {
    //使地图容器填充整个界面
    var height = $("#map_main").height();
    var width = $("#map_main").width();
    $("#map").css({
      "width": "100%",
      "height": height.toString() + "px",
      "position": "absolute"
    });
    /*---------------------下面是初始化地图--------------------------------*/

    var map = new BMap.Map("map");
    var get_position = new BMap.Geolocation();
    get_position.getCurrentPosition(function (e) {
      map.panTo(e.point);
      var initial_position = new BMap.Marker(e.point, {
        icon: new BMap.Icon("images/launch_map/place.png", new BMap.Size(50, 50), {})
      });
      map.addOverlay(initial_position); //将当前位置存储到launch.html中(只是暂时存储)

      var coder = new BMap.Geocoder(); //写入城市信息

      coder.getLocation(e.point, function (m) {
        $("#launch_info #launch_city").attr("value", m.addressComponents.city);
      }, {}); //写入坐标信息

      $("#launch_lat").attr("value", e.point.lat);
      $("#launch_lng").attr("value", e.point.lng);
    }, {}); //如果定位失败,默认定位至天安门

    map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
    map.enableScrollWheelZoom(true);
    /*---------------------下面是定位功能控件------------------------------*/

    var now_position;
    var now_city;
    var geolocationControl = new BMap.GeolocationControl({
      locationIcon: new BMap.Icon("images/launch_map/place.png", new BMap.Size(50, 50), {}),
      showAddressBar: false,
      anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
      offset: new BMap.Size(10, height * 0.2)
    });
    geolocationControl.addEventListener("locationError", function (e) {
      alert("定位失败");
    });
    geolocationControl.addEventListener("locationSuccess", function (e) {
      now_position = e.point;
    });
    map.addControl(geolocationControl);
    /*---------------------下面是搜索功能控件------------------------------*/

    function ZoomControl() {
      // 设置默认停靠位置和偏移量  
      this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT;
      this.defaultOffset = new BMap.Size(0, 0);
    }

    ZoomControl.prototype = new BMap.Control();

    ZoomControl.prototype.initialize = function (map) {
      //搜索框父容器
      var div = document.createElement("div");
      div.style.width = "90%";
      div.style.marginLeft = "5%";
      div.style.height = "5%";
      div.style.marginTop = (height * 0.025).toString() + "px"; //搜索框放大镜

      var img0 = div.appendChild(document.createElement("img"));
      img0.setAttribute("src", "images/launch_map/find.png");
      img0.style.height = "60%";
      img0.style.width = "5%";
      img0.style.position = "absolute";
      img0.style.marginLeft = "2%";
      img0.style.marginTop = (height * 0.05 * 0.2).toString() + "px"; //搜索框输入栏

      var input0 = div.appendChild(document.createElement("input"));
      input0.setAttribute("id", "text");
      input0.style.width = "100%";
      input0.style.paddingLeft = "10%";
      input0.style.height = "100%";
      input0.style.fontWeight = "bold";
      input0.style.caretColor = "red";
      input0.style.background = "white";
      input0.style.border = "0px";
      input0.style.borderRadius = "10px"; //搜索框提交按钮

      var input1 = div.appendChild(document.createElement("input"));
      input1.type = "submit";
      input1.value = "搜索";
      input1.setAttribute("id", "search");
      input1.style.width = "15%";
      input1.style.height = "100%";
      input1.style.fontWeight = "bold";
      input1.style.fontSize = "10px";
      input1.style.position = "absolute";
      input1.style.marginLeft = "-15%";
      input1.style.border = "0px";
      input1.style.background = "#D8D8D8";
      input1.style.borderTopRightRadius = "10px";
      input1.style.borderBottomRightRadius = "10px"; //搜索后展示菜单

      var show_detail = document.createElement("div");
      show_detail.setAttribute("id", "show_detail");
      show_detail.style.width = "90%";
      show_detail.style.height = "100px";
      show_detail.style.position = "absolute";
      show_detail.style.zIndex = "9999";
      show_detail.style.marginTop = (height * 0.05 + width * 0.05).toString() + "px";
      show_detail.style.marginLeft = "5%"; //搜索事件

      input1.onclick = function () {
        var target = $("#text").val();
        map.getContainer().appendChild(show_detail);
        var local = new BMap.LocalSearch(map, {
          //设置展示在该地图上,展示在show_detail这个html元素上
          renderOptions: {
            panel: show_detail
          },
          //展示菜单结果的回调函数
          onResultsHtmlSet: function onResultsHtmlSet(ele) {
            //list是ol
            var list = $($(ele).children()[0]).children()[0];
            var content;
            var click_position;
            var click_city;

            for (var i = 0; i < $(list).children().length; i++) {
              $(list).children()[i].onclick = function () {
                //获取当前绑定元素的父亲(由于这个版本的zepto无法绑定传参所以只能这样获取this是ol列表中的第几个,以便获取精确定位)
                var father_of_list = $(this).parent()[0]; //用于存储当前点击的li的具体信息(html中未显示的信息),因为无法传参所以只能穷举

                var result; //进行搜索已经限制了一页显示最多五个内容,所以这里穷举五次

                for (var j = 0; j < 5; j++) {
                  if ($(father_of_list).children()[j] == this) {
                    result = local.getResults().getPoi(j);
                    break;
                  }
                } //获取点击的li的标题内容


                content = result.title; //获取搜索位置

                click_position = result.point; //获取搜索的城市

                click_city = result.city; //获取当前定位的位置

                now_position = new BMap.Point($("#launch_lng").val(), $("#launch_lat").val()); //初始化UI界面,把之前的提示框信息删除

                $("#text").val("");
                $("#occur_ele").remove();
                $("#ensure_ele").remove();
                if ($("#address p").text() != "请点击右侧图标选择地址") $("#address p").remove();
                map.removeOverlay(marker_point);
                /*-----------------下面是选择提示框-------------------------*/

                var ensure = document.createElement("div");
                ensure.setAttribute("id", "ensure_ele");
                ensure.style.height = "5%";
                ensure.style.position = "absolute";
                ensure.style.zIndex = "9999";
                ensure.style.width = (width * 0.3).toString() + "px";
                ensure.style.marginLeft = "35%";
                ensure.style.background = "white";
                ensure.style.borderRadius = "20px";
                ensure.style.marginTop = (height * 0.765).toString() + "px";
                ensure.style.boxShadow = "10px 10px 10px #eee";
                ensure.style.textAlign = "center";
                ensure.style.lineHeight = (height * 0.05).toString() + "px";
                ensure.style.color = "red";
                ensure.style.fontWeight = "bold";
                ensure.style.fontSize = "17.5px";

                ensure.onclick = function () {
                  $("#address p").remove(); //插入到发起页面

                  var insert_address = document.createElement("p");
                  insert_address.style.overflow = "hidden";
                  insert_address.style.whiteSpace = "nowrap";
                  insert_address.style.textOverflow = "ellipsis";
                  $(insert_address).prepend(content);
                  $("#address").prepend(insert_address); //把地图界面信息存储至发起界面

                  $("#launch_info #launch_city").attr("value", click_city);
                  $("#launch_info #launch_lng").attr("value", click_position.lng);
                  $("#launch_info #launch_lat").attr("value", click_position.lat);
                  $("#launch_info #launch_detail").attr("value", result.address);
                  bui.back();
                }; //将选择提示框加载到百度地图中


                $("#map_main").prepend(ensure);
                $("#ensure_ele").prepend("选择");
                /*-----------------下面是点击提示框(必须进行动态渲染)---------*/
                //提示框父元素(容器)

                var occur = document.createElement("div");
                occur.setAttribute("id", "occur_ele");
                occur.style.position = "absolute";
                occur.style.zIndex = "9999";
                occur.style.width = "90%";
                occur.style.height = "15";
                occur.style.marginLeft = "5%";
                occur.style.borderRadius = "20px";
                occur.style.background = "white";
                occur.style.marginTop = (height * 0.825).toString() + "px"; //显示地址栏的容器

                var address = occur.appendChild(document.createElement("div"));
                address.setAttribute("id", "address2");
                address.style.width = "80%";
                address.style.height = "40%";
                address.style.marginLeft = (width * 0.9 * 0.05).toString() + "px";
                address.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
                address.style["float"] = "left"; //地址栏图片

                var address_img = address.appendChild(document.createElement("img"));
                address_img.setAttribute("src", "images/launch_map/build.png");
                address_img.setAttribute("id", "address_img");
                address_img.style.height = (height * 0.15 * 0.4 * 0.6).toString() + "px";
                address_img.style.width = (height * 0.15 * 0.4 * 0.6).toString() + "px";
                address_img.style.marginTop = (height * 0.15 * 0.4 * 0.2).toString() + "px";
                address_img.style["float"] = "left"; //地址栏文字

                var address_p = address.appendChild(document.createElement("p"));
                address_p.setAttribute("id", "address_p");
                address_p.style["float"] = "left";
                address_p.style.marginLeft = "10px";
                address_p.style.width = (width * 0.9 * 0.8 - height * 0.15 * 0.4 * 0.6 - 25).toString() + "px";
                address_p.style.color = "black";
                address_p.style.fontSize = "25px";
                address_p.style.fontWeight = "bold";
                address_p.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
                address_p.style.overflow = "hidden";
                address_p.style.whiteSpace = "nowrap";
                address_p.style.textOverflow = "ellipsis"; //退出提示框

                var del = occur.appendChild(document.createElement("img"));
                del.setAttribute("src", "images/launch_map/del.png");
                del.style["float"] = "right";
                del.style.marginTop = "10px";
                del.style.marginRight = "10px";

                del.onclick = function () {
                  $("#occur_ele").remove();
                  $("#ensure_ele").remove();
                  map.removeOverlay(marker_point);
                }; //显示具体位置的容器


                var cross = occur.appendChild(document.createElement("div"));
                cross.setAttribute("id", "cross");
                cross.style.width = "42.5%";
                cross.style.height = "40%";
                cross.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
                cross.style.marginLeft = (width * 0.9 * 0.05).toString() + "px";
                cross.style["float"] = "left"; //显示具体位置的图片

                var cross_img = cross.appendChild(document.createElement("img"));
                cross_img.setAttribute("src", "images/launch_map/position.png");
                cross_img.setAttribute("id", "cross_img");
                cross_img.style.height = (height * 0.15 * 0.4 * 0.6).toString() + "px";
                cross_img.style.width = (height * 0.15 * 0.4 * 0.6).toString() + "px";
                cross_img.style.marginTop = (height * 0.15 * 0.4 * 0.2).toString() + "px";
                cross_img.style["float"] = "left"; //显示具体位置的文字

                var cross_p = cross.appendChild(document.createElement("p"));
                cross_p.setAttribute("id", "cross_p");
                cross_p.style["float"] = "left";
                cross_p.style.marginLeft = "10px";
                cross_p.style.width = (width * 0.9 * 0.42 - height * 0.15 * 0.4 * 0.6 - 10).toString() + "px";
                cross_p.style.color = "black";
                cross_p.style.fontSize = "15px";
                cross_p.style.fontWeight = "bold";
                cross_p.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
                cross_p.style.overflow = "hidden";
                cross_p.style.whiteSpace = "nowrap";
                cross_p.style.textOverflow = "ellipsis"; //中间分隔符

                var spliter = occur.appendChild(document.createElement("div"));
                spliter.setAttribute("id", "spliter");
                spliter.style["float"] = "left";
                spliter.style.width = (width * 0.9 * 0.05).toString() + "px";
                spliter.style.height = "40%";
                spliter.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
                spliter.style.color = "gray";
                spliter.style.textAlign = "center";
                spliter.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
                spliter.style.fontSize = "20px";
                spliter.style.fontWeight = "bold"; //显示距离使用者的距离的容器

                var distance = occur.appendChild(document.createElement("div"));
                distance.setAttribute("id", "distance");
                distance.style.width = "42.5%";
                distance.style.height = "40%";
                distance.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
                distance.style["float"] = "left"; //显示距离的文字

                var distance_p = distance.appendChild(document.createElement("p"));
                distance_p.setAttribute("id", "distance_p");
                distance_p.style["float"] = "left";
                distance_p.style.width = (width * 0.9 * 0.425).toString() + "px";
                distance_p.style.color = "black";
                distance_p.style.fontSize = "15px";
                distance_p.style.fontWeight = "bold";
                distance_p.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
                distance_p.style.overflow = "hidden";
                distance_p.style.whiteSpace = "nowrap";
                distance_p.style.textOverflow = "ellipsis"; //将点击提示框载入百度地图中

                $("#map_main").prepend(occur);
                var p = document.createElement("div");
                $("#address_p").append(content);
                $("#cross_p").append(result.address);
                $("#spliter").append("|");
                $("#distance_p").append("据您距离" + ": " + Math.round(map.getDistance(now_position, click_position)).toString() + "米"); //显示点击提示图片

                marker_point = new BMap.Marker(click_position, {
                  icon: new BMap.Icon("images/launch_map/place_32.png", new BMap.Size(50, 50), {})
                });
                map.addOverlay(marker_point);
                map.panTo(click_position); //清空页面以便进行显示

                $("#show_detail").remove();
              }; //弹窗函数结束

            }
          }
        });
        local.setPageCapacity(5);
        local.search(target); //点击任意键删除展示菜单

        map.addEventListener("click", function (e) {
          $("#show_detail").empty();
        });
      };

      map.getContainer().appendChild(div);
      return div;
    };

    var myZoomCtrl = new ZoomControl();
    map.addControl(myZoomCtrl);
    /*---------------------下面是点击事件-----------------------------*/
    //坐标提示作用域必须是包涵click事件,否则用户重复点击时无法删除上一次的坐标提示

    var marker_point;

    var test_function = function test_function(e) {
      /*-----------------下面是关于点击事件的初始化-----------------*/
      //获取当前的位置
      now_position = new BMap.Point($("#launch_lng").val(), $("#launch_lat").val()); //如果用户进行多次点击,那么在点击时,先删除上一次弹出的提示框和坐标提示

      $("#occur_ele").remove();
      $("#ensure_ele").remove();
      if ($("#address p").text() != "请点击右侧图标选择地址") $("#address p").remove();
      map.removeOverlay(marker_point);
      /*-----------------下面是关于点击位置的计算------------------*/
      //由于无法通过坐标直接获得这个地点的名称标题,只能通过POI点获取标题
      //且POI点都是展示该点周围的POI点,所以会造成无法获取点击位置的名称标题的情况
      //现在构造一个point和点击点稍有差别的点,以此为中心进行poi搜索,这样点击点就可以包含在poi结果中了

      var get_address = new BMap.Geocoder();
      get_address.getLocation(new BMap.Point(e.point.lng - 0.00005, e.point.lat - 0.00005), function (m) {
        //获取详细POI信息
        var t = m.surroundingPois;

        if (t.length != 0) {
          var minimum_distance = 0x3f3f3f3f;
          var target_position;

          for (var i = 0; i < t.length; i++) {
            // console.log(t[i].title);
            // console.log(Math.round(map.getDistance(e.point,t[i].point)));
            if (Math.round(map.getDistance(e.point, t[i].point)) < minimum_distance) {
              minimum_distance = Math.round(map.getDistance(e.point, t[i].point));
              target_position = i;
            }
          }
          /*-----------------下面是选择提示框-------------------------*/


          var ensure = document.createElement("div");
          ensure.setAttribute("id", "ensure_ele");
          ensure.style.height = "5%";
          ensure.style.position = "absolute";
          ensure.style.zIndex = "9999";
          ensure.style.width = (width * 0.3).toString() + "px";
          ensure.style.marginLeft = "35%";
          ensure.style.background = "white";
          ensure.style.borderRadius = "20px";
          ensure.style.marginTop = (height * 0.765).toString() + "px";
          ensure.style.boxShadow = "10px 10px 10px #eee";
          ensure.style.textAlign = "center";
          ensure.style.lineHeight = (height * 0.05).toString() + "px";
          ensure.style.color = "red";
          ensure.style.fontWeight = "bold";
          ensure.style.fontSize = "17.5px";

          ensure.onclick = function () {
            $("#address p").remove(); //插入到发起页面

            var insert_address = document.createElement("p");
            insert_address.style.overflow = "hidden";
            insert_address.style.whiteSpace = "nowrap";
            insert_address.style.textOverflow = "ellipsis";
            $(insert_address).prepend(t[target_position].title);
            $("#address").prepend(insert_address); //把地图界面信息存储至发起界面

            $("#launch_info #launch_city").attr("value", m.addressComponents.city);
            $("#launch_info #launch_lng").attr("value", e.point.lng);
            $("#launch_info #launch_lat").attr("value", e.point.lat);
            $("#launch_info #launch_detail").attr("value", t[target_position].address);
            bui.back();
          }; //将选择提示框加载到百度地图中


          $("#map_main").prepend(ensure);
          $("#ensure_ele").prepend("选择");
          /*-----------------下面是点击提示框(必须进行动态渲染)---------*/
          //提示框父元素(容器)

          var occur = document.createElement("div");
          occur.setAttribute("id", "occur_ele");
          occur.style.position = "absolute";
          occur.style.zIndex = "9999";
          occur.style.width = "90%";
          occur.style.height = "15";
          occur.style.marginLeft = "5%";
          occur.style.borderRadius = "20px";
          occur.style.background = "white";
          occur.style.marginTop = (height * 0.825).toString() + "px"; //显示地址栏的容器

          var address = occur.appendChild(document.createElement("div"));
          address.setAttribute("id", "address2");
          address.style.width = "80%";
          address.style.height = "40%";
          address.style.marginLeft = (width * 0.9 * 0.05).toString() + "px";
          address.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
          address.style["float"] = "left"; //地址栏图片

          var address_img = address.appendChild(document.createElement("img"));
          address_img.setAttribute("src", "images/launch_map/build.png");
          address_img.setAttribute("id", "address_img");
          address_img.style.height = (height * 0.15 * 0.4 * 0.6).toString() + "px";
          address_img.style.width = (height * 0.15 * 0.4 * 0.6).toString() + "px";
          address_img.style.marginTop = (height * 0.15 * 0.4 * 0.2).toString() + "px";
          address_img.style["float"] = "left"; //地址栏文字

          var address_p = address.appendChild(document.createElement("p"));
          address_p.setAttribute("id", "address_p");
          address_p.style["float"] = "left";
          address_p.style.marginLeft = "10px";
          address_p.style.width = (width * 0.9 * 0.8 - height * 0.15 * 0.4 * 0.6 - 25).toString() + "px";
          address_p.style.color = "black";
          address_p.style.fontSize = "25px";
          address_p.style.fontWeight = "bold";
          address_p.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
          address_p.style.overflow = "hidden";
          address_p.style.whiteSpace = "nowrap";
          address_p.style.textOverflow = "ellipsis"; //退出提示框

          var del = occur.appendChild(document.createElement("img"));
          del.setAttribute("src", "images/launch_map/del.png");
          del.style["float"] = "right";
          del.style.marginTop = "10px";
          del.style.marginRight = "10px";

          del.onclick = function () {
            $("#occur_ele").remove();
            $("#ensure_ele").remove();
            map.removeOverlay(marker_point);
          }; //显示具体位置的容器


          var cross = occur.appendChild(document.createElement("div"));
          cross.setAttribute("id", "cross");
          cross.style.width = "42.5%";
          cross.style.height = "40%";
          cross.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
          cross.style.marginLeft = (width * 0.9 * 0.05).toString() + "px";
          cross.style["float"] = "left"; //显示具体位置的图片

          var cross_img = cross.appendChild(document.createElement("img"));
          cross_img.setAttribute("src", "images/launch_map/position.png");
          cross_img.setAttribute("id", "cross_img");
          cross_img.style.height = (height * 0.15 * 0.4 * 0.6).toString() + "px";
          cross_img.style.width = (height * 0.15 * 0.4 * 0.6).toString() + "px";
          cross_img.style.marginTop = (height * 0.15 * 0.4 * 0.2).toString() + "px";
          cross_img.style["float"] = "left"; //显示具体位置的文字

          var cross_p = cross.appendChild(document.createElement("p"));
          cross_p.setAttribute("id", "cross_p");
          cross_p.style["float"] = "left";
          cross_p.style.marginLeft = "10px";
          cross_p.style.width = (width * 0.9 * 0.42 - height * 0.15 * 0.4 * 0.6 - 10).toString() + "px";
          cross_p.style.color = "black";
          cross_p.style.fontSize = "15px";
          cross_p.style.fontWeight = "bold";
          cross_p.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
          cross_p.style.overflow = "hidden";
          cross_p.style.whiteSpace = "nowrap";
          cross_p.style.textOverflow = "ellipsis"; //中间分隔符

          var spliter = occur.appendChild(document.createElement("div"));
          spliter.setAttribute("id", "spliter");
          spliter.style["float"] = "left";
          spliter.style.width = (width * 0.9 * 0.05).toString() + "px";
          spliter.style.height = "40%";
          spliter.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
          spliter.style.color = "gray";
          spliter.style.textAlign = "center";
          spliter.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
          spliter.style.fontSize = "20px";
          spliter.style.fontWeight = "bold"; //显示距离使用者的距离的容器

          var distance = occur.appendChild(document.createElement("div"));
          distance.setAttribute("id", "distance");
          distance.style.width = "42.5%";
          distance.style.height = "40%";
          distance.style.marginTop = (height * 0.15 * 0.05).toString() + "px";
          distance.style["float"] = "left"; //显示距离的文字

          var distance_p = distance.appendChild(document.createElement("p"));
          distance_p.setAttribute("id", "distance_p");
          distance_p.style["float"] = "left";
          distance_p.style.width = (width * 0.9 * 0.425).toString() + "px";
          distance_p.style.color = "black";
          distance_p.style.fontSize = "15px";
          distance_p.style.fontWeight = "bold";
          distance_p.style.lineHeight = (height * 0.15 * 0.4).toString() + "px";
          distance_p.style.overflow = "hidden";
          distance_p.style.whiteSpace = "nowrap";
          distance_p.style.textOverflow = "ellipsis"; //将点击提示框载入百度地图中

          $("#map_main").prepend(occur);
          var p = document.createElement("div");
          $("#address_p").append(t[target_position].title);
          $("#cross_p").append(m.address);
          $("#spliter").append("|");
          $("#distance_p").append("据您距离" + ": " + Math.round(map.getDistance(e.point, now_position)).toString() + "米"); //显示点击提示图片

          marker_point = new BMap.Marker(e.point, {
            icon: new BMap.Icon("images/launch_map/place_32.png", new BMap.Size(50, 50), {})
          });
          map.addOverlay(marker_point);
        } //if(t.length!=0)

      }, {
        numPois: 10000,
        poiRadius: 10000
      }); //getLocation函数
    }; //点击事件


    map.addEventListener("click", test_function);
  };

  pageview.init();
  return pageview;
});
},{}]},{},[1]);
